package com.finance3.springmvc.servlet;

import java.io.IOException;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.finance3.springmvc.dao.queryUser;
import com.finance3.springmvc.dao.queryUserImple;

public class repasswordServlet extends HttpServlet{
	
	@Override
	protected void service(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
		String uid=req.getParameter("uid");
		String password=req.getParameter("password");
		queryUser querydao = new queryUserImple();
		int i = querydao.alertUser(uid, password);
		String alertMsg="";
		if(i==1) {
			alertMsg="修改成功,继续修改或者去登录";
			//resp.sendRedirect("query.jsp");
		}
		else {
			alertMsg="抱歉，密码修改失败，继续修改";
			req.setAttribute("alertMsg", alertMsg);
			req.getRequestDispatcher("repassword.jsp").forward(req, resp);
		}
		req.setAttribute("alertMsg", alertMsg);
		//req.setAttribute("u, o);
		req.getRequestDispatcher("repassword.jsp").forward(req, resp);
		

	}
}
